; fpu.asm
;
;  Copyright 2005 Corey Tabaka
;
;  Licensed under the Apache License, Version 2.0 (the "License");
;  you may not use this file except in compliance with the License.
;  You may obtain a copy of the License at
;
;      http://www.apache.org/licenses/LICENSE-2.0
;
;  Unless required by applicable law or agreed to in writing, software
;  distributed under the License is distributed on an "AS IS" BASIS,
;  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
;  See the License for the specific language governing permissions and
;  limitations under the License.
;

section .text
bits 32

[global _fpu_init]
[global _fpu_save]
[global _fpu_restore]
[global _fpu_save_sse]
[global _fpu_restore_sse]

_fpu_init:
	fninit
	ret

_fpu_save:
	mov eax,[esp+4]
	fnsave [eax]
	ret

_fpu_restore:
	mov eax,[esp+4]
	frstor [eax]
	ret

_fpu_save_sse:
	mov eax, [esp+4]
	fxsave [eax]
	ret

_fpu_restore_sse:
	mov eax, [esp+4]
	fxrstor [eax]
	ret
	